Skip to content

refactor: JSON converter improvements#29

Merged
tymondesigns merged 6 commits into
mainfrom
refactor/json-converter-improvements
Jun 11, 2026
Merged

refactor: JSON converter improvements#29
tymondesigns merged 6 commits into
mainfrom
refactor/json-converter-improvements

Conversation

@tymondesigns

@tymondesigns tymondesigns commented Jun 11, 2026

Copy link
Copy Markdown
Contributor
  • Complete JsonConverter keyword coverage — refactored from per-type duplicated keyword blocks to a shared applyCommonKeywords() pipeline, ensuring every schema type receives full coverage for $comment, examples, deprecated, readOnly, writeOnly, enum, const, default, format, $ref, $anchor, allOf/anyOf/oneOf/not, if/then/else, and $defs/definitions
  • New builder capabilities — added dependentRequired (on HasProperties), tupleItems + additionalItems (on HasItems), a new HasAnchor trait with $anchor support, and a UnionSchema::typeless() factory for composition/definition-only schemas that correctly omit the type keyword
  • Object keywords — converter now handles patternProperties, propertyNames, unevaluatedProperties, dependentSchemas, dependentRequired
  • Array keywords — converter now handles prefixItems, unevaluatedItems, additionalItems, and draft-07 tuple-style items arrays
  • Typeless schema detection — schemas without a type keyword that carry structural keywords ($ref, allOf, $defs, properties, required, etc.) are no longer incorrectly converted to UnionSchema with all 7 types emitted
  • 18 JSON fixtures from json-schema.org/learn/miscellaneous-examples and json-schema.org/learn/json-schema-examples added under tests/Fixtures/json-schema-org/
  • Round-trip fixture testsJsonConverterFixturesTest asserts every source keyword is present in the converted output using a SchemaRoundTrip subset helper
  • 13 new focused unit tests covering each newly supported keyword group (conditionals, $ref, $defs, $anchor, metadata, patternProperties, propertyNames, dependentSchemas, dependentRequired, prefixItems, unevaluatedItems, additionalItems, typeless schemas, boolean const)

@tymondesigns tymondesigns marked this pull request as ready for review June 11, 2026 08:39
@tymondesigns tymondesigns merged commit abb1554 into main Jun 11, 2026
18 checks passed
@tymondesigns tymondesigns deleted the refactor/json-converter-improvements branch June 11, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant